package bbs.utils;

import bbs.entity.enums.VerifyRegexEnum;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class VerifyUtils {
    public static Boolean verify(String verifyCode, String sessionCode) {
        if (StringTools.isEmpty(sessionCode)) {
            return false;
        }
        Pattern pattern = Pattern.compile(verifyCode);
        Matcher matcher = pattern.matcher(sessionCode);
        return matcher.matches();
    }

    public static Boolean verify(VerifyRegexEnum regexEnum, String value) {
        return verify(regexEnum.getRegex(), value);
    }
}
